<%--
  Created by IntelliJ IDEA.
  User: 浅汐
  Date: 2020/11/24
  Time: 20:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="Head.jsp"%>

<%
    String s="";
    Cookie[] cookies=request.getCookies();
    for(Cookie cookie:cookies){
        if(cookie.getName().equals("auto")) {
            s=cookie.getValue();
        }
    }
    if(s.equals("on")) {
        response.sendRedirect("success.go");
    }

%>

<script type="text/javascript">
    //验证码：防止程序或者机器恶意注册，防止恶意密码暴力破解，防止访问攻击
    function changeimg() {
        var btn=document.getElementById("btn");
        var img=document.getElementById("img");
        //防止验证码图片缓存
        img.src="vali.go?tm"+new Date().getTime();
    }



</script>


<div class="login">
    <div class="login-main center">
        <form action="check.go" class="login-form">
            <div>
                <h2>账号</h2>
                <br>
                <input type="text" name="uname" value="${cookie.get("name").value}" class="id" placeholder="用户名/邮箱">
            </div>
            <br>
            <div>
                <h2>密码</h2>
                <br>
                <input type="password" name="upwd"  value="${cookie.get("pwd").value}" id="passw" class="pwd" placeholder="密码">
            </div>
            <br>
            <div>
                <h2>验证码</h2>
                <input type="text" name="vali"  class="valitext"/>
                <div class="vali-img">
                    <img alt="验证码" src="vali.go" id="img" />
                    <input type="button" value="看不清？" onclick="changeimg()" id="btn" />
                </div>
            </div>
            <br/>
            <div>
                <input type="checkbox" name="check"><span>记住我</span>
            </div>
            <div>
                <input type="checkbox" name="auto"><span>自动登录</span>
            </div>
            <input type="submit" name="login" value="login" class="loginbtn">
            <a href="register.jsp"> <input type="button" name="register" value="register" class="registerbtn"></a>
        </form>
        </form>
    </div>
</div>


<%@ include file="foot.jsp"%>
